#include "AlButton.h"

CAlButton::CAlButton(void)
{
	m_hover=false;
	m_clicked=false;
}

CAlButton::~CAlButton(void)
{
}


bool CAlButton::IsInside( int px,int py )
{
	if(CAllegroWindow::isInside(px,py))
	{
		m_hover=true;
	}
	else
	{
		m_hover=false;
	}
	return m_hover;
}

void CAlButton::OnClick()
{
	m_clicked=true;
}

void CAlButton::Draw( BITMAP* sb )
{
	CAllegroWindow::Draw(sb);
	if(m_clicked)
	{
		m_clicked=false;
		rect(sb,m_x1,m_y1,m_x2,m_y2,makecol(255,0,0));
	}
	else if(m_hover)
		rect(sb,m_x1,m_y1,m_x2,m_y2,makecol(0,255,0));
}